package com.rongc.client.freight.base.model;

import com.rongc.client.core.utils.DateUtil;
import com.rongc.client.core.utils.StringUtils;

import java.util.ArrayList;
import java.util.Calendar;

/**
 * Created by Lenovo on 2016/9/5.
 */
public class ProvinceList {

    private static ArrayList<ProvinceBean> options1Items = new ArrayList<>();
    private static ArrayList<ArrayList<ProvinceBean>> options2Items = new ArrayList<>();



     public static ArrayList<ProvinceBean> getOptions1Items(){
            options1Items.clear();

         String str1 = DateUtil.getCurrentDate(DateUtil.dateFormatYMD);
         String str2 = DateUtil.getCurrentDateByOffset(DateUtil.dateFormatYMD, Calendar.DAY_OF_MONTH,1);
         String str3 = DateUtil.getCurrentDateByOffset(DateUtil.dateFormatYMD, Calendar.DAY_OF_MONTH,2);
//        str1 = DateUtil.formatDateStr3Desc(str1,DateUtil.dateFormatYMDHMS,DateUtil.dateFormatMD);
//        str2 = DateUtil.formatDateStr3Desc(str2,DateUtil.dateFormatYMDHMS,DateUtil.dateFormatMD);
//        str3 = DateUtil.formatDateStr3Desc(str3,DateUtil.dateFormatYMDHMS,DateUtil.dateFormatMD);
         String hourTemp = DateUtil.getCurrentDate(DateUtil.dateFormatH);
         int hour = StringUtils.parseInt(hourTemp);
         if(hour != 23)
            options1Items.add(new ProvinceBean(0,str1,"今天",""));

         options1Items.add(new ProvinceBean(1,str2,"明天",""));
         options1Items.add(new ProvinceBean(2,str3,"后天",""));



         return options1Items;

     }



    public static ArrayList<ArrayList<ProvinceBean>> getOptions2Items(){
        options2Items.clear();

        ArrayList<ProvinceBean> options2Items_01=new ArrayList<>();
        String hourTemp = DateUtil.getCurrentDate(DateUtil.dateFormatH);
        int hour = StringUtils.parseInt(hourTemp)+1;

        if(hour < 24) {
            for (int i = hour; i < 24; i++) {
                String tempHour = StringUtils.makeGdPeriod(i);
                for (int j = 0; j < 60; ) {
                    String temp = tempHour + ":" + StringUtils.makeGdPeriod(j);
                    options2Items_01.add(new ProvinceBean(0, temp + ":00", temp, ""));
                    j += 30;
                }
            }
            options2Items.add(options2Items_01);
        }

        ArrayList<ProvinceBean> options2Items_02=new ArrayList<>();
        hour = 0;
        for (int i = hour;i < 24;i++){
            String tempHour = StringUtils.makeGdPeriod(i);
            for (int j = 0; j< 60;){
                String temp = tempHour + ":" + StringUtils.makeGdPeriod(j);
                options2Items_02.add(new ProvinceBean(1,temp+":00",temp,""));
                j +=30;
            }
        }
        ArrayList<ProvinceBean> options2Items_03=new ArrayList<>();
        hour = 0;
        for (int i = hour;i < 24;i++){
            String tempHour = StringUtils.makeGdPeriod(i);
            for (int j = 0; j< 60;){
                String temp = tempHour + ":" + StringUtils.makeGdPeriod(j);
                options2Items_03.add(new ProvinceBean(2,temp+":00",temp,""));
                j +=30;
            }
        }
        options2Items.add(options2Items_02);
        options2Items.add(options2Items_03);


        return options2Items;

    }
}
